@extends('layouts.app')
@section('content')
    @foreach($chapters as $chapter)
        <tig-chapter-item :chapter="{{json_encode($chapter)}}">
            <template slot="bottom" class="mt-2">
                <h4 class="mb-3">该章节被以下作品启用：</h4>
                <ul>
                    @forelse($chapter->repositories as $repository)
                        <li><a href="{{route('repositories.show',['repository'=>$repository])}}">{{$repository->title}}</a>章节序号：{{$repository->pivot->sequence}}
                        </li>
                    @empty
                        <p>该章节没有被任何作品引用</p>
                    @endforelse
                </ul>
            </template>
        </tig-chapter-item>


    @endforeach

    {{$chapters->links()}}
@endsection